function sumColumn(convertFunction,name)
{
	name += '_';
	var inputs = document.getElementsByTagName("input");
	var result = 0;	
	var elemID = '';
	
	var i = 0;
	var value = 0;
	while(i < inputs.length)
	{
		elemID = inputs[i].id;		
		if(elemID.indexOf(name)==0){
			if((inputs[i].value != null) && (inputs[i].value != ''))
			{
				value = parseFloat(inputs[i].value.replace('.',','));	
				result = result + value;
			}
		}
		i++;
	}
	var evalVar = convertFunction + '(result)';
	return eval(evalVar);
}

function calc(data) {
	
	var c1C3 = data.XLEW_1_3_3, c1F3 = data.XLEW_1_3_6;
	var c1E8 = 0, c1F8 = 0, c1G8 = 0, c1H8 = 0, c1I8 = 0, c1J8 = 0, c1K8 = 0, 
	c1E12 = 0, c1F12 = 0, c1G12 = 0, c1H12 = 0, c1I12 = 0, c1J12 = 0, 
	c1K12 = 0, c2C3 = c1C3, c2F3 = c1F3, c2E8 = 0, c2F8 = 0, c2G8 = 0, 
	c2H8 = 0, c2I8 = 0, c2J8 = 0, c2E12 = 0, c2F12 = 0, c2G12 = 0, 
	c2H12 = 0, c2I12 = 0, c2J12 = 0, c3C3 = c1C3, c3F3 = c1F3, c3E8 = 0, 
	c3F8 = 0, c3H8 = 0, c3E12 = 0, c3F12 = 0, c3H12 = 0, c4C3 = c1C3, 
	c4F3 = c1F3, c4E8 = 0, c4F8 = 0, c4L8 = 0, c4E12 = 0, c4F12 = 0, 
	c4L12 = 0, c5C3 = c1C3, c5F3 = c1F3,c1E15 = 0, c1F15 = 0,
	c1G15 = 0, c1H15 = 0, c1I15 = 0, c1J15 = 0, c1K15 = 0, c2E15 = 0,
	c2F15 = 0, c2G15 = 0, c2H15 = 0, c2I15 = 0, c2J15 = 0, c3E15 = 0, 
	c3F15 = 0, c3H15 = 0, c4E15 = 0, c4F15 = 0, c4L15 = 0;
	
	c1E8 = sumColumn('eeparseFloatTh','XLEW_1_7_5');
	c1F8 = sumColumn('eeparseFloat','XLEW_1_7_6');
	c1G8 = sumColumn('eeparseFloat','XLEW_1_7_7');
	c1H8 = sumColumn('eeparseFloat','XLEW_1_7_8');
	c1I8 = sumColumn('eeparseFloat','XLEW_1_7_9');
	c1J8 = sumColumn('eeparseFloat','XLEW_1_7_10');
	c1K8 = sumColumn('eeparseFloat','XLEW_1_7_11');
	
	c1E12 = sumColumn('eeparseFloatTh','XLEW_1_11_5');
	c1F12 = sumColumn('eeparseFloat','XLEW_1_11_6');
	c1G12 = sumColumn('eeparseFloat','XLEW_1_11_7');
	c1H12 = sumColumn('eeparseFloat','XLEW_1_11_8');
	c1I12 = sumColumn('eeparseFloat','XLEW_1_11_9');
	c1J12 = sumColumn('eeparseFloat','XLEW_1_11_10');
	c1K12 = sumColumn('eeparseFloat','XLEW_1_11_11');
	
	c1E15 = c1E8 + c1E12; 
	c1F15 = c1F8 + c1F12;
	c1G15 = c1G8 + c1G12;
	c1H15 = c1H8 + c1H12;
	c1I15 = c1I8 + c1I12;
	c1J15 = c1J8 + c1J12;
	c1K15 = c1K8 + c1K12;
	
	c2E8 = sumColumn('eeparseFloatTh','XLEW_2_7_5');
	c2F8 = sumColumn('eeparseFloat','XLEW_2_7_6');
	c2G8 = sumColumn('eeparseFloat','XLEW_2_7_7');
	c2H8 = sumColumn('eeparseFloat','XLEW_2_7_8');
	c2I8 = sumColumn('eeparseFloat','XLEW_2_7_9');
	c2J8 = sumColumn('eeparseFloat','XLEW_2_7_10');
	
	c2E12 = sumColumn('eeparseFloatTh','XLEW_2_11_5');
	c2F12 = sumColumn('eeparseFloat','XLEW_2_11_6');
	c2G12 = sumColumn('eeparseFloat','XLEW_2_11_7');
	c2H12 = sumColumn('eeparseFloat','XLEW_2_11_8');
	c2I12 = sumColumn('eeparseFloat','XLEW_2_11_9');
	c2J12 = sumColumn('eeparseFloat','XLEW_2_11_10');
	
	c2E15 = c2E8 + c2E12;
	c2F15 = c2F8 + c2F12;
	c2G15 = c2G8 + c2G12;
	c2H15 = c2H8 + c2H12;
	c2I15 = c2I8 + c2I12;
	c2J15 = c2J8 + c2J12;
		
	c3E8 = sumColumn('eeparseFloatTh','XLEW_3_7_5');
	c3F8 = sumColumn('eeparseFloat','XLEW_3_7_6');
	c3H8 = sumColumn('eeparseFloat','XLEW_3_7_8');
	
	c3E12 = sumColumn('eeparseFloatTh','XLEW_3_11_5');
	c3F12 = sumColumn('eeparseFloat','XLEW_3_11_6');
	c3H12 = sumColumn('eeparseFloat','XLEW_3_11_8');
	
	c3E15 = c3E8 + c3E12;
	c3F15 = c3F8 + c3F12;
	c3H15 = c3H8 + c3H12;
	
	c4E8 = sumColumn('eeparseFloatTh','XLEW_4_7_5');
	c4F8 = sumColumn('eeparseFloat','XLEW_4_7_6');
	c4L8 = sumColumn('eeparseFloat','XLEW_4_7_12');
	
	c4E12 = sumColumn('eeparseFloatTh','XLEW_4_11_5');
	c4F12 = sumColumn('eeparseFloat','XLEW_4_11_6');
	c4L12 = sumColumn('eeparseFloat','XLEW_4_11_12');
	
	c4E15 = c4E8 + c4E12;
	c4F15 = c4F8 + c4F12;
	c4L15 = c4L8 + c4L12;
	
	data.XLEW_5_3_3 = c5C3;
	data.XLEW_5_3_6 = c5F3;
	data.XLEW_4_3_3 = c4C3;
	data.XLEW_4_3_6 = c4F3;
	data.XLEW_4_8_5 = c4E8;
	data.XLEW_4_8_6 = c4F8;
	data.XLEW_4_8_12 = c4L8;
	data.XLEW_4_12_5 = c4E12;
	data.XLEW_4_12_6 = c4F12;
	data.XLEW_4_12_12 = c4L12;
	data.XLEW_4_15_5 = c4E15;
	data.XLEW_4_15_6 = c4F15;
	data.XLEW_4_15_12 = c4L15;
	data.XLEW_3_3_3 = c3C3;
	data.XLEW_3_3_6 = c3F3;
	data.XLEW_3_8_5 = c3E8;
	data.XLEW_3_8_6 = c3F8;
	data.XLEW_3_8_8 = c3H8;
	data.XLEW_3_12_5 = c3E12;
	data.XLEW_3_12_6 = c3F12;
	data.XLEW_3_12_8 = c3H12;
	data.XLEW_3_15_5 = c3E15;
	data.XLEW_3_15_6 = c3F15;
	data.XLEW_3_15_8 = c3H15;
	data.XLEW_2_3_3 = c2C3;
	data.XLEW_2_3_6 = c2F3;
	data.XLEW_2_8_5 = c2E8;
	data.XLEW_2_8_6 = c2F8;
	data.XLEW_2_8_7 = c2G8;
	data.XLEW_2_8_8 = c2H8;
	data.XLEW_2_8_9 = c2I8;
	data.XLEW_2_8_10 = c2J8;
	data.XLEW_2_12_5 = c2E12;
	data.XLEW_2_12_6 = c2F12;
	data.XLEW_2_12_7 = c2G12;
	data.XLEW_2_12_8 = c2H12;
	data.XLEW_2_12_9 = c2I12;
	data.XLEW_2_12_10 = c2J12;
	data.XLEW_2_15_5 = c2E15;
	data.XLEW_2_15_6 = c2F15;
	data.XLEW_2_15_7 = c2G15;
	data.XLEW_2_15_8 = c2H15;
	data.XLEW_2_15_9 = c2I15;
	data.XLEW_2_15_10 = c2J15;
	data.XLEW_1_8_5 = c1E8;
	data.XLEW_1_8_6 = c1F8;
	data.XLEW_1_8_7 = c1G8;
	data.XLEW_1_8_8 = c1H8;
	data.XLEW_1_8_9 = c1I8;
	data.XLEW_1_8_10 = c1J8;
	data.XLEW_1_8_11 = c1K8;
	data.XLEW_1_12_5 = c1E12;
	data.XLEW_1_12_6 = c1F12;
	data.XLEW_1_12_7 = c1G12;
	data.XLEW_1_12_8 = c1H12;
	data.XLEW_1_12_9 = c1I12;
	data.XLEW_1_12_10 = c1J12;
	data.XLEW_1_12_11 = c1K12;
	data.XLEW_1_15_5 = c1E15;
	data.XLEW_1_15_6 = c1F15;
	data.XLEW_1_15_7 = c1G15;
	data.XLEW_1_15_8 = c1H15;
	data.XLEW_1_15_9 = c1I15;
	data.XLEW_1_15_10 = c1J15;
	data.XLEW_1_15_11 = c1K15;
}